package com.yjhz.ruleengine.demos.controller;

import com.yjhz.ruleengine.demos.entity.Order;
import com.yjhz.ruleengine.demos.service.OrderService;
import lombok.RequiredArgsConstructor;
import org.kie.api.runtime.KieSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orders")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class OrderController {

    private final OrderService orderService;

    @PostMapping("/apply-discount")
    public Order applyDiscount(@RequestBody Order order) {
        return orderService.applyDiscount(order);
    }
}
